let express = require('express');
let app = express();
app.listen(3000, () => {
    console.log('服务器已启动。。。');
});
// 引入跨域插件
let cors = require('cors');
app.use(cors())

// 引入封装好的数据
let DB = require('./db/db')

// 第一个
app.get("/yi", async (req,res)=>{
    let sql=`select *  from first_area`
    let [err,result]=await DB(sql)
    res.send({
        status:200,
        msg:"请求成功",
        result
    })

} )



// 第二个
app.get("/er", async  (req,res)=>{
    let {fid}=req.query
    let sql=`select *  from second_area where fid=${fid}`
    let [err,result]=await DB(sql)

    res.send({
        status:200,
        msg:"请求成功",
        result
    })

})

// 第三个
app.get("/san",async (req,res)=>{
    let {fid}=req.query
    let sql=`select *  from third_area where fid=${fid}`
    let [err,result]=await DB(sql)
    res.send({
        status:200,
        msg:"请求成功",
        result
    })
})